package cn.kgc.service.impl;

import cn.kgc.mapper.BillMapper;

import cn.kgc.pojo.SmbmsBill;
import cn.kgc.service.BillService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("billService")
public class BillServiceimpl implements BillService {

    @Resource
    BillMapper billMapper;
    @Override
    public int getBillConut(String productName, Integer isPayment) {
        return billMapper.getBillConut(productName,isPayment);
    }

    @Override
    public List<SmbmsBill> getBillByPage(Integer currentPageNo, Integer pageSize, String productName, Integer isPayment) {
        Integer pageNo = (currentPageNo-1)*pageSize;
        return billMapper.getBillByPage(pageNo,pageSize,productName,isPayment);
    }

    @Override
    public boolean addBill(SmbmsBill smbmsBill) {
        int conut = billMapper.addBill(smbmsBill);
        if (conut>0){
            return true;
        }else {
            return false;
        }
    }

    @Override
    public boolean updateBill(SmbmsBill smbmsBill) {
        int conut = billMapper.updateBill(smbmsBill);
        if (conut>0){
            return true;
        }else {
            return false;
        }
    }

    @Override
    public boolean delBillId(Integer id) {
        int conut = billMapper.delBillId(id);
        if (conut>0){
            return true;
        }else {
            return false;
        }
    }

    @Override
    public SmbmsBill getBillId(Integer id) {
        return billMapper.getBillId(id);
    }

    @Override
    public SmbmsBill getBillCode(String billCode) {
        return billMapper.getBillCode(billCode);
    }
}
